//
//  ZCActivitydescriptionVC.m
//  zctx
//
//  Created by apple on 16/2/26.
//  Copyright © 2016年 sanliang. All rights reserved.
//

#import "ZCActivitydescriptionVC.h"

@interface ZCActivitydescriptionVC ()

@end

@implementation ZCActivitydescriptionVC

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"ZCActivitydescriptionVC"];
    [MTA trackPageViewBegin:@"ZCActivitydescriptionVC"];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"ZCActivitydescriptionVC"];
    [MTA trackPageViewEnd:@"ZCActivitydescriptionVC"];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"食品安全小卫士评选";
    
    
//    [self initnavegation];
    
    self.view.backgroundColor = [UIColor colorWithHexString:@"#F1FBFE"];
    
    UIScrollView *scroll = [[UIScrollView alloc]init];
    [self.view addSubview:scroll];
    if (([[[UIDevice currentDevice] systemVersion] floatValue] >=9.0)
) {
        [scroll mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.view).with.insets(UIEdgeInsetsMake(0, 0,0, 0));
        }];
    }else{
        [scroll mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.view).with.insets(UIEdgeInsetsMake(64,0,49, 0));
        }];
    }
        scroll.bounces = NO;
    
    // 1.创建UIImageView（图片）
    UIImageView *imageView = [[UIImageView alloc] init];
    imageView.image = [UIImage imageNamed:@"enroll_head"];

    imageView.frame = CGRectMake(0, 0,SCREEN_WIDTH,192);
    [scroll addSubview:imageView];
    
    // 2.创建UIImageView（图片）
    UIImageView *imageView1 = [[UIImageView alloc] init];
    imageView1.image = [UIImage imageNamed:@"enroll_act"];

    CGFloat imgW1 = imageView1.image.size.width; // 图片的宽度
    CGFloat imgH1 = imageView1.image.size.height; // 图片的高度
    imageView1.frame = CGRectMake(0,192+20,SCREEN_WIDTH,imgH1 * (SCREEN_WIDTH/imgW1));
    [scroll addSubview:imageView1];
    imageView1.userInteractionEnabled = YES;
    
    
    // 3.设置scrollView的属性
    
    // 设置UIScrollView的滚动范围（内容大小）
    scroll.contentSize = CGSizeMake(SCREEN_WIDTH, 192+imgH1 *(SCREEN_WIDTH/imgW1)+20+60);
}

#pragma mark 导航栏
-(void)initnavegation{
    
    UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(0, 0, 19, 36);
    [leftButton setImage:[UIImage imageNamed:@"navigation_back"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(backButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * barButtonItem_leftNavBar = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = barButtonItem_leftNavBar;
}


-(void)backButtonPressed{
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
